//项目路由
import {lazy,Suspense} from "react"
import {Route,Redirect,Switch} from 'react-router-dom'
import Loading from '@/components/Loading'

//用户列表
const User = lazy(()=>import('@/views/user/Userlist'))
const Role = lazy(()=>import('@/views/role/Role'))
const Goods = lazy(()=>import('@/views/goods/Goods'))
const Product = lazy(()=>import('@/views/product/Product'))
const Charts =lazy(()=>import('@/views/charts/Charts'))

const AddUpdate = lazy(()=>import('@/views/product/ProductAddUpdate'))
const Detail = lazy(()=>import('@/views/product/ProductDetail'))
// const Upload =lazy(()=>import('@/views/upload/Upload'))
//
const Routes =()=>{
    return (
        <Suspense fallback={<Loading/>}>
            <Switch>
                <Route path="/home/userlist" component={User}></Route>
                <Route path="/home/role" component={Role}></Route>
                <Route path="/home/goods" component={Goods}></Route>
                <Route path="/home/product" component={Product}></Route>
                <Route path="/home/charts" component={Charts}></Route>
                <Route path="/home/addupdata/:id" component={AddUpdate}></Route>
                <Route path="/home/detail" component={Detail}></Route>
                <Redirect from="/"to="/home"></Redirect>
            </Switch>
        </Suspense>
    )
}
export default Routes